app.directive('chartSecond',function () {
    return {
        scope: {
            id:'@',
            data:'='
        },
        restrict: 'E',
        template: '<div style="width:100%;height:300px;"></div>',
        replace: true,
        link: function($scope, element, attrs, controller) {
            config2 = {
                tooltip : {
                    trigger: 'axis',
                    formatter: "{b}",
                    axisPointer : {
                        type : 'shadow'
                    }
                },
                xAxis: {
                    type : 'value',
                    position: 'top',
                    splitLine: {lineStyle:{type:'dashed'}},
                },
                grid: {
                    top: "11%",
                    bottom: '1%'
                },
                yAxis: {
                    type : 'category',
                    axisLine: {show: false},
                    axisLabel: {show: false},
                    axisTick: {show: false},
                    splitLine: {show: false},
                    data: ["隐患风险", "隐患级别", "隐患整改率", "未兑现培训", "未兑现演练", "事故级别", "未参与度", "排查偏差","自查自改率" ],
                },
                series: [{
                    type:'bar',
                    name: "表格2",
                    radius: '100%',
                    label: {
                        normal: {
                            show: true,
                            position: "right",
                            formatter: function(params){
                                return params.data[1];
                            },
                            textStyle: {
                                color: '#2f4554',
                            }
                        }
                    }}]

            }
            var chart2 = echarts.init(document.getElementById('chart2'));

            chart2.setOption(config2);
        }
    }
});